<div id="form"></div>
<script>
var frm=$("#form").ajajform({
	header: "{{!Page templates}}",
	footerButtons: [
		{value: "{{!Create}}",url: "{{action}}?mode=edit"}
	]
});
var grid=frm.ajajform("insertWidget",null,null,{
	type: "grid",
	title: "",
	name: "items",
	rowClasses: [{
		name:"template",
		columns: [
			{name: "name", label: "{{!Name}}", width: 400, url: '{{action}}?mode=edit&id='},
			{name: "code", label: "{{!Filename}}", width: 150},
			{name: "places_cnt", label: "{{!Places in tmpl}}", width: 120},
			{name: "pages_cnt", label: "{{!Pages use it}}", width: 120},
			{name: "edit_link", label: " ", width: 30, url: '{{action}}?mode=edit&id=',html:1},
			{name: "delete_link", label: " ", width: 30, url: '{{action}}?mode=delete&id=',html:1}
		]
	}]
});
var items={{JSON:items}};
for (var i=0;i<items.length;i++) {
	var tmpl=items[i];
	grid.ajajform_grid("insertRow",null,{rowClass: "template",cells:[tmpl.name,tmpl.code,tmpl.places_cnt,tmpl.pages_cnt,'<img src="/shared/icons/edit.png"/>','<img src="/shared/icons/delete.png"/>'],id:tmpl.id});
}
</script>

